<template>
	<view class="box">
		<page-head :transparent='false'>
		    <slot slot="title">{{title.length>10?title.substr(0,10)+'...':title}}</slot>
		</page-head>
		<view class="top-box">
			<image :src="banner" mode="widthFix"></image>
		</view>
		<view v-for="(item, i) in sqsgList" :key="i" class="pro-box">
			<image :src="item.sqsg" mode="widthFix" @click="linkTo(item.url)"></image>
		</view>
	</view>
</template>

<script>
	import banner from '../../static/img/sqsg/banner.png'
	import sqsg1 from '../../static/img/sqsg/sqsg1.png'
	import sqsg2 from '../../static/img/sqsg/sqsg2.png'
	import sqsg3 from '../../static/img/sqsg/sqsg3.png'
	import sqsg4 from '../../static/img/sqsg/sqsg4.png'
	import sqsg5 from '../../static/img/sqsg/sqsg5.png'
	import sqsg6 from '../../static/img/sqsg/sqsg6.png'
	import sqsg7 from '../../static/img/sqsg/sqsg7.png'
	import sqsg8 from '../../static/img/sqsg/sqsg8.png'
	import sqsg9 from '../../static/img/sqsg/sqsg9.png'
	import sqsg10 from '../../static/img/sqsg/sqsg10.png'
	import sqsg11 from '../../static/img/sqsg/sqsg11.png'
	import sqsg12 from '../../static/img/sqsg/sqsg12.png'
	
	export default {
		data () {
			return {
				title:'睡前时光',
				banner: banner,
				sqsgList: [
					{sqsg: sqsg1, url: '../selfdetail/selfdetail?skuId=3634&cid=383&title=富居 地毯 加柔长绒客厅地毯地垫 茶几卧室地毯防滑地垫 140*200cm 灰色&seller=好品购'},
					{sqsg: sqsg2, url: '../selfdetail/selfdetail?skuId=3631&cid=410&title=德尔玛（Deerma）加湿器 3L容量 空气加湿 静音迷你办公室卧室家用 香薰加湿两用加湿器 DEM-F380&seller=好品购'},
					{sqsg: sqsg3, url: '../selfdetail/selfdetail?skuId=2266&cid=417&title=迪斯（Desleep）足疗仪按摩器  足部脚底 足疗机 &seller=京东自营'},
					{sqsg: sqsg4, url: '../selfdetail/selfdetail?skuId=3626&cid=571&title=Dr.JYS 泡脚药包脚医生泡脚粉（驱寒祛湿艾草艾叶老姜足浴粉包去足浴盐脚气脚臭）非老北京足贴药 20g*20袋&seller=京东自营'},
					{sqsg: sqsg5, url: '../selfdetail/selfdetail?skuId=3538&cid=714&title=小熊（Bear）养生壶煮茶器煮茶壶花茶壶 1.5L电水壶热水壶烧水壶&seller=京东自营'},
					{sqsg: sqsg6, url: '../selfdetail/selfdetail?skuId=3635&cid=546&title=中粮 悦活 优选100 洋槐蜜 蜂蜜 300g瓶&seller=好品购'},
					{sqsg: sqsg7, url: '../selfdetail/selfdetail?skuId=3625&cid=571&title=巴斯克林（Bathclin）美肌淋浴盐 花香型 420g（日本进口新老包装随机发）&seller=京东自营'},
					{sqsg: sqsg8, url: '../selfdetail/selfdetail?skuId=1128&cid=92,629&title=御泥坊 美白嫩肤睡眠面膜（美白祛斑淡斑 晒后修护补水熬夜免洗复配烟酰胺面膜男女）&seller=京东自营'},
					{sqsg: sqsg9, url: '../selfdetail/selfdetail?skuId=3636&cid=566&title=飞利浦(PHILIPS) LED护眼台灯 学生学习阅读灯 卧室宿舍床头灯台夹两用【三段调光】 酷迈 粉色&seller=好品购'},
					{sqsg: sqsg10, url: '../selfdetail/selfdetail?skuId=3623&cid=240&title=索爱（soaiy）S-52 蓝牙音箱炫彩床头灯 手机便携插卡电脑迷你小音响 重低音炮户外无线智能小音箱 酷睿黑&seller=好品购'},
					{sqsg: sqsg11, url: '../selfdetail/selfdetail?skuId=3637&cid=588&title=多喜爱（Dohia）凉席 可折叠清凉印花冰丝席三件套 夏凉席子 芳屿觅林 1.5米床 150*200cm&seller=好品购'},
					{sqsg: sqsg12, url: '../selfdetail/selfdetail?skuId=2774&cid=116&title=水星家纺 全棉四件套纯棉 斜纹印花床品套件床单被罩被单 品格宣言（绿色） 双人加大1.8米床&seller=京东自营'},
				]
			}
		},
		onLoad() {
			this.genCommonData()
			this.imgList()
		},
		methods: {
			genCommonData() {
				const that = this
				let url = window.location.href;
				console.log("url===" + url);
				let reg_url = /^[^\?]+\?([\w\W]+)$/,
					reg_para = /([^&=]+)=([\w\W]*?)(&|$|#)/g,
					arr_url = reg_url.exec(url),
					ret = {};
				if (arr_url && arr_url[1]) {
					let str_para = arr_url[1],
						result;
					while ((result = reg_para.exec(str_para)) != null) {
						ret[result[1]] = result[2];
					}
				}
				let token = ret.token;
				if (token != '' && token != 'null' && token != null && token != undefined && token != 'undefined') {
					uni.setStorageSync('token', decodeURI(token));
					uni.setStorageSync('bump', bump);
				}
				// console.log("token==" + token);
			},
			imgList() {
				// const that = this;
				// that.sqsgList.map((item, i) => {
				// 	item.url = this.urlLink[i]
				// })
				// console.log(that.sqsgList)
			},
			linkTo(url) {
				if(url !== '') {
					// console.log('url='+url);
					uni.navigateTo({
						url: decodeURI(url)
					});
				}
			}
		},
	}
</script>

<style lang="scss" scoped>
	.box{
		width: 100%;
		
		.top-box{
			width: 100%;
			
			image{
				width: 100%;
				display: block;
			}
		}
		
		.pro-box{
			width: 100%;
			
			image{
				width: 100%;
				display: block;
			}
		}
	}
</style>
